package com.ssy.lingxi.settle.accounts.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 结算商品DO-待对账列表-商品明细数据来源
 * @author Saske
 * @date 2021/12/14
 * @version 2.0.0
 */
@Entity
@Table(schema = "public",name = "sa_settlement_product",
        indexes = {@Index(name = "sa_settlement_product_payWay_idx",columnList = "payWay"),
                @Index(name = "sa_settlement_product_expectPayTime_idx",columnList = "expectPayTime"),
                @Index(name = "sa_settlement_product_taxRate_idx",columnList = "taxRate"),
                @Index(name = "sa_settlement_product_reconciliationQuantity_idx",columnList = "reconciliationQuantity")
        })
public class SettlementProductDO implements Serializable {

    private static final long serialVersionUID = -1524681655248741L;

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "settlement_product_seq")
    @SequenceGenerator(sequenceName = "sa_settlement_product_seq", name = "settlement_product_seq", allocationSize = 1)
    private Long id;

    /**
     * 多对一双向关联结算订单信息
     */
    @JsonBackReference
    @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional = false)
    @JoinColumn(name = "order_id")
    private SettlementOrderDO order;

    /**
     * 付款方式：
     * 定义在 PurchaseContractPayTypeEnum 中
     */
    @Column(columnDefinition = "int")
    private Integer payWay;

    /**
     * 付款方式参数-月：付款方式为账期-月，显示月数
     */
    @Column(columnDefinition = "int")
    private Integer payMonth;

    /**
     * 付款方式参数-日：付款方式为账期-月或者账期-天，显示日期或天数
     */
    @Column(columnDefinition = "int")
    private Integer payDate;

    /**
     * 预计结算日期
     */
    @Column(name = "expectPayTime")
    private LocalDateTime expectPayTime;

    /**
     * 物料编码
     */
    @Column(name = "productNo")
    private String productNo;

    /**
     * 物料名称
     */
    @Column(name = "name")
    private String name;

    /**
     * 商品规格
     */
    @Column(name = "spec")
    private String spec;

    /**
     * 商品品类
     */
    @Column(name = "category")
    private String category;

    /**
     * 商品品牌
     */
    @Column(name = "brand")
    private String brand;

    /**
     * 单位
     */
    @Column(name = "unit")
    private String unit;

    /**
     * 税率（百分比的分子部分）
     */
    @Column(name = "taxRate",columnDefinition = "decimal")
    private BigDecimal taxRate;

    /**
     * 单价（含税）
     */
    @Column(name = "price",columnDefinition = "decimal")
    private BigDecimal price;

    /**
     * 收货数量
     */
    @Column(name = "receiveQuantity",columnDefinition = "decimal")
    private BigDecimal receiveQuantity;

    /**
     * 已对账数量
     */
    @Column(name = "reconciledQuantity",columnDefinition = "decimal")
    private BigDecimal reconciledQuantity;

    /**
     * 已对账金额
     */
    @Column(name = "reconciledMoney",columnDefinition = "decimal")
    private BigDecimal reconciledMoney;

    /**
     * 待对账数量
     */
    @Column(name = "reconciliationQuantity",columnDefinition = "decimal")
    private BigDecimal reconciliationQuantity;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public SettlementOrderDO getOrder() {
        return order;
    }

    public void setOrder(SettlementOrderDO order) {
        this.order = order;
    }

    public Integer getPayWay() {
        return payWay;
    }

    public void setPayWay(Integer payWay) {
        this.payWay = payWay;
    }

    public Integer getPayMonth() {
        return payMonth;
    }

    public void setPayMonth(Integer payMonth) {
        this.payMonth = payMonth;
    }

    public Integer getPayDate() {
        return payDate;
    }

    public void setPayDate(Integer payDate) {
        this.payDate = payDate;
    }

    public LocalDateTime getExpectPayTime() {
        return expectPayTime;
    }

    public void setExpectPayTime(LocalDateTime expectPayTime) {
        this.expectPayTime = expectPayTime;
    }

    public String getProductNo() {
        return productNo;
    }

    public void setProductNo(String productNo) {
        this.productNo = productNo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public BigDecimal getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(BigDecimal taxRate) {
        this.taxRate = taxRate;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getReceiveQuantity() {
        return receiveQuantity;
    }

    public void setReceiveQuantity(BigDecimal receiveQuantity) {
        this.receiveQuantity = receiveQuantity;
    }

    public BigDecimal getReconciledQuantity() {
        return reconciledQuantity;
    }

    public void setReconciledQuantity(BigDecimal reconciledQuantity) {
        this.reconciledQuantity = reconciledQuantity;
    }

    public BigDecimal getReconciledMoney() {
        return reconciledMoney;
    }

    public void setReconciledMoney(BigDecimal reconciledMoney) {
        this.reconciledMoney = reconciledMoney;
    }

    public BigDecimal getReconciliationQuantity() {
        return reconciliationQuantity;
    }

    public void setReconciliationQuantity(BigDecimal reconciliationQuantity) {
        this.reconciliationQuantity = reconciliationQuantity;
    }
}
